package cn.qyd.other;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * @author 邱运铎
 * @date 2024-03-19 11:25
 */
public class Demo20240319 {

    public HashMap<String, List<Integer>> hashMap = new HashMap<>();

    public void show() {
        List<Integer> list = get("key");
        list.add(10);
    }

    public List<Integer> get(String key) {
        return hashMap.computeIfAbsent(key, k -> new ArrayList<Integer>());
    }
    public static void main(String[] args) {
        Demo20240319 demo = new Demo20240319();
        for (int i = 0; i < 10; i++) {
            demo.show();
        }

        System.out.println(demo.hashMap);
    }
}
